#coding=utf-8
from django.db import models
from member.models import *

# Create your models here.

class Feed(models.Model):
    owner           = models.ForeignKey(Member, verbose_name = '所有者')
    name            = models.CharField('名字', max_length = 32, blank = False)
    description     = models.CharField('描述', max_length = 256, blank = True)
    url             = models.URLField('永久链接', max_length = 512, blank = False)
    type            = models.CharField('类型', max_length = 32, blank = False, default = 'BaseFeedType')
    status          = models.CharField('状态', max_length = 32, default = '')
    private         = models.BooleanField('私有', default = False)
    version         = models.CharField('版本', max_length = 32, blank = False)
    share           = models.IntegerField('推荐', default = 0)
    rank            = models.FloatField('评分', default = 0)
    createDate      = models.DateTimeField('创建时间', auto_now_add = True)
    updateDate      = models.DateTimeField('更新时间', auto_now = True)
    updateDateStr   = models.CharField('更新时间字符', max_length = 32, default = '')
    
    class Meta:
        get_latest_by           = "createDate"
        verbose_name_plural 	= '种子'

    def get_absolute_url(self):
        return "/f/%i/" % self.id

    def __unicode__(self):
        return '%s' % (self.name)
